#include <cstdio>
#include <cstring>
#define min(a,b) (((a)<(b))?(a):(b))
int n, head[ 101 ], node[ 201 ], next[ 201 ], e, a[ 101 ], b[ 101 ];
int f[ 101 ][ 4 ];
bool visit[ 101 ];

void addedge( int u, int v ) { node[ e ] = v; next[ e ] = head[ u ]; head[ u ] = e++; }

void init( )
{
    int i, u, v;
    memset( head, -1, sizeof( head ) );
    e = 0;
    for ( i = 0; i < n; i++ )
        scanf("%d", &a[ i ]);
    for ( i = 0; i < n; i++ )
        scanf("%d", &b[ i ]);
    for ( i = 0; i < n - 1; i++ )
    {
        scanf("%d%d", &u, &v); u--; v--;
        addedge( u, v );
        addedge( v, u );
    }
    memset( f, 0, sizeof( f ) );
    memset( visit, 0, sizeof( visit ) );
}

void dfs( int p )
{
    int i, v, q1 = a[ p ], q2 = b[ p ];
    visit[ p ] = 1;
    for ( i = head[ p ]; i != -1; i = next[ i ] )
    {
        v = node[ i ];
        if ( !visit[ v ] )
        {
            dfs( v );
            f[ p ][ 0 ] += min( f[ v ][ 0 ], f[ v ][ 3 ] );
            f[ p ][ 2 ] += min( f[ v ][ 1 ], f[ v ][ 2 ] );
            q1 = min( q1, a[ p ] / 2 + f[ v ][ 1 ] - min( f[ v ][ 0 ], f[ v ][ 3 ] ) );
            q2 = min( q2, b[ p ] / 2 + f[ v ][ 3 ] - min( f[ v ][ 1 ], f[ v ][ 2 ] ) );
        }
    }
    f[ p ][ 1 ] = f[ p ][ 0 ] + q1;
    f[ p ][ 3 ] = f[ p ][ 2 ] + q2;
    f[ p ][ 0 ] += a[ p ] / 2;
    f[ p ][ 2 ] += b[ p ] / 2;
    //printf("%d %d %d %d %d\n", p, f[ p ][ 0 ], f[ p ][ 1 ], f[ p ][ 2 ], f[ p ][ 3 ]);
}

int main( )
{
    while ( scanf("%d", &n) != EOF )
    {
        init( );
        dfs( 0 );
        printf("%d\n", min( f[ 0 ][ 1 ], f[ 0 ][ 3 ] ));
    }
    return 0;
}
